const path = require("path");
module.exports = {
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [path.resolve(__dirname, "src/global.less")],
    },
  },
  publicPath: "/",
  lintOnSave: false,
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    resolve: {
      alias: {
        "@": resolve("src"),
      },
    },
    devtool: "source-map",
  },
  devServer: {
    https: true,
    proxy: {
      "/api": {
        target: "https://18.18.10.229/", // 这里是你要代理到的目标地址
        changeOrigin: true,
      },
      "/wd": {
        target: `http://localhost:8083/`,
        changeOrigin: true,
        pathRewrite: {
          ["^/wd"]: "",
        },
      },
      // "/aws": {
      //   target: `http://localhost:8083/`,
      //   changeOrigin: true,
      //   pathRewrite: {
      //     ["^/aws"]: "ws",
      //   },
      // },
      "/ws": {
        target: "https://18.18.10.229", // 这里是你要代理到的目标地址
        pathRewrite: { "^/ws": "/ws" },
        changeOrigin: true,
      },
      "/rtc": {
        target: "https://18.18.10.229/", // 这里是你要代理到的目标地址
        changeOrigin: true,
      },
    },
  },
  // css: {
  //   loaderOptions: {
  //     postcss: {
  //       plugins: [
  //         require('postcss-px2rem')({
  //           remUnit: 100
  //         })
  //       ]
  //     }
  //   }
  // },
  // package.json
  // "postcss-px2rem": "^0.3.0"
};

function resolve(dir) {
  return path.join(__dirname, dir);
}
